<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); 

class Block_Post_Layer extends Core_Block {

	protected $_collection = null;
	
	protected $_filterBLocks = array(
		'post_filter_category' => 'Block_Post_Filter_Category',
		'post_filter_status' => 'Block_Post_Filter_Status',
		'post_filter_rating' => 'Block_Post_Filter_Rating',
		'post_filter_tag' => 'Block_Post_Filter_Tag'
	);

	protected function _prepareLayout() {
		foreach ($this->_filterBLocks as $name => $class) {
			$filter = $this->getLayout()->createBlock($name, $class);
			$this->append($filter);
			$filter->setLayer($this)->apply();
		}
	}
	
	public function getCollection() {
		if (!$this->_collection)
			$this->_collection = App::object('Entity_Post')->getCollection();
		return $this->_collection;
	}
}